import { createRouter, createWebHistory } from 'vue-router'
import Login from '../views/Login.vue'
import Register from '../views/Register.vue'
import TourismRecommendation from '../views/TourismRecommendation.vue'
import MyDiary from '../views/MyDiary.vue' // 引入旅游日记页面
import CreateDiary from '@/views/CreateDiary.vue'
import ShowMap from '@/views/ShowMap.vue' // 确保路径正确
import DiaryDetail from '@/views/DiaryDetail.vue' // 引入旅游日记详情页面
import SpotDetail from '@/views/SpotDetail.vue' // 引入旅游景点详情页面
const routes = [
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/register',
    name: 'Register',
    component: Register
  },
  {
    path: '/tourism-recommendation',
    name: 'TourismRecommendation',
    component: TourismRecommendation
  },
  {
    path: '/my-diary', // 旅游日记页面路径
    name: 'MyDiary',
    component: MyDiary
  },
  {
    path: '/create-diary', // 旅游日记页面路径
    name: 'CreateDiary',
    component: CreateDiary
  },
  {
    path: '/diary-detail/:id', // 新增动态路由
    name: 'DiaryDetail',
    component: DiaryDetail,
    props: true
  },
  {
    path: '/spot-detail/:id', // 新增动态路由
    name: 'SpotDetail',
    component: SpotDetail,
    props: true
  },
  {
    path: '/show-map',
    name: 'ShowMap',
    component: ShowMap
  },
  {
    path: '/',
    redirect: '/login'
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router